<template>
  <div id="selectionlist">
    <section class="wboxnoborder">
      <div>
        <el-scrollbar style="height: calc(100% + 16px);">
          <div style="margin:15px">
              <el-table :data="personlist" highlight-current-row v-loading="listLoading" style="width: 100%; margin-bottom:15px" border >
                <el-table-column prop="realName" label="姓名" width="80" show-overflow-tooltip>
                </el-table-column>
                <el-table-column label="凡提四必">
                  <el-table-column label="查核干部档案">
                    <template slot-scope="scope">
                      <i v-show="scope.row.stateCadreArchives===-1" class="icon_c_-1"></i>
                      {{scope.row.resultCadreArchives}}
                    </template>
                  </el-table-column>
                  <el-table-column label="查核有关事项">
                    <template slot-scope="scope">
                      <i v-show="scope.row.statePersonalMatters===-1" class="icon_c_-1"></i>
                      {{scope.row.resultPersonalMatters}}
                    </template>
                  </el-table-column>
                  <el-table-column label="征求纪检监察部门意见">
                    <template slot-scope="scope">
                      <i v-show="scope.row.stateSolicitingOpinions===-1" class="icon_c_-1"></i>
                      {{scope.row.resultSolicitingOpinions}}
                    </template>
                  </el-table-column>
                  <el-table-column label="线索举报调查">
                    <template slot-scope="scope">
                      <i v-show="scope.row.stateClueReporting===-1" class="icon_c_-1"></i>
                      {{scope.row.resultClueReporting}}
                    </template>
                  </el-table-column>
                </el-table-column>
                <el-table-column label="是否进行后续工作" width="100">
                  <template slot-scope="scope">
                    <span v-show="scope.row.isAffected">否</span>
                    <span v-show="!scope.row.isAffected">是</span>
                  </template>
                </el-table-column>
              </el-table>
            <div>
              <el-radio-group v-model="tabitem" @change="changedept" style="margin:0 0 15px">
                <el-radio-button :label="1" :disabled="stateCadreArchives!==2" v-if="stateCadreArchives!==-1">查核干部档案</el-radio-button>
                <el-radio-button :label="2" :disabled="statePersonalMatters!==2" v-if="statePersonalMatters!==-1">查核有关事项</el-radio-button>
                <el-radio-button :label="3" :disabled="stateSolicitingOpinions!==2" v-if="stateSolicitingOpinions!==-1">征求纪检监察部门意见</el-radio-button>
                <el-radio-button :label="4" :disabled="stateClueReporting!==2" v-if="stateClueReporting!==-1">线索举报调查</el-radio-button>
              </el-radio-group>
            </div>
          </div>
          <detail :substep="tabitem" :personid='personId'></detail>
          <notice :noticePersonId="personId" step="2"></notice>
        </el-scrollbar>
      </div>
    </section>
  </div>
</template>

<script>
import detail from './common/detail'
import notice from '../common/Notice'
export default {
  components: {
    detail,
    notice
  },
  props: ['personId', 'substep'],
  watch: {
    personId: {
      handler (newName, oldName) {
        this.tabitem = this.substep
        this.getftsb(this.personId)
        this.changedept()
      },
      immediate: true
    },
    substep: {
      handler (newName, oldName) {
        this.tabitem = this.substep
        this.getftsb(this.personId)
        this.changedept()
      },
      immediate: true
    }
  },
  data () {
    return {
      todoTitle: '查核干部档案',
      tabitem: 1,
      tabdept: 1,
      todoDetailVisible: false,
      personlist: [],
      listLoading: false,
      editpersonid: 0,
      stateCadreArchives: '',
      statePersonalMatters: '',
      stateSolicitingOpinions: '',
      stateClueReporting: ''
    }
  },
  methods: {
    getftsb (personid) {
      if (personid) {
        let para = {
          personId: personid
        }
        this.listLoading = true
        this.$http
          .post(this.$http.defaults.selectionAPI + `api/selection/necessary/getPersonStepInfo`, para)
          .then(response => {
            if (response.data.success) {
              this.personlist = []
              this.personlist.push(response.data.result)
              this.stateCadreArchives = response.data.result.stateCadreArchives
              this.statePersonalMatters = response.data.result.statePersonalMatters
              this.stateSolicitingOpinions = response.data.result.stateSolicitingOpinions
              this.stateClueReporting = response.data.result.stateClueReporting
            } else {
              this.$message({
                message: '获取失败:' + response.data.message,
                type: 'error'
              })
            }
            this.listLoading = false
          })
          .catch(error => {
            this.$message({
              message: '网络获取失败:' + error,
              type: 'error'
            })
            this.listLoading = false
          })
      }
    },
    changedept () {
      if (this.tabitem === 1) {
        this.todoTitle = '查核干部档案'
      }
      if (this.tabitem === 2) {
        this.todoTitle = '查核有关事项'
      }
      if (this.tabitem === 3) {
        this.todoTitle = '征求纪检监察部门意见'
      }
      if (this.tabitem === 4) {
        this.todoTitle = '线索举报调查'
      }
    },
    showTodoDetail (id) {
      console.log('personid:' + id)
      this.editpersonid = id
      this.todoDetailVisible = true
    }
  }
}
</script>
<style>
  #selectionlist .wboxnoborder .el-table{
    border: #95B8E7 solid 1px;
  }
  #selectionlist .wboxnoborder .el-table th{
    font-weight: normal;
    background-image: linear-gradient(to bottom , #f8f8f8, #efefef);
    text-align: center;
    border-right: #95B8E7 solid 1px;
    border-bottom: #95B8E7 solid 1px;
    min-height: 30px;
    line-height:30px;
  }
  #selectionlist .wboxnoborder .el-table td, .el-table th{
    padding:0;
    font-size:var(--size14) !important;
    line-height: 20px;
    font-family: '宋体';
    text-align: center;
  }
  #selectionlist .el-table__row{
    height: 50px;
  }
</style>
<style scoped>
  #selectionlist .cell i {
    width: 30px;
    height: 30px;
    background-position: center center;
    background-repeat: no-repeat;
    float: center;
    display: block;
    cursor: pointer;
    margin: 0 auto;
  }
  .workflowmsg ul{
    background:#F5F7FA;
    margin:0 20px 20px;
    padding:10px 0;
  }
  .workflowmsg li{
    padding:0;
    list-style: none;
    margin-left:20px;
    line-height: 200%;
    font-size:var(--size) !important;
  }
  h1{
    font-size:var(--size16) !important;
    font-weight: bolder;
    height: 30px;
    border-bottom: 1px solid #95B8E7;
    font-family: '宋体';
    line-height: 30px;
    color: #000;
    padding-left:10px;
    background-image: linear-gradient(to bottom , #EEF4FF, #E0ECFF);
    margin:0;
  }
  h3{
    font-size:var(--size16) !important;
    font-weight: bolder;
    padding-left: 20px;
  }
  .el-pagination{
    float: left;
    padding:7px 10px;
  }
  .wboxs{
    padding:5px 15px;
    width: calc(100% - 30px);
    background: #fff;
    border: 1px solid #95B8E7;
    margin:0 10px;
    overflow: hidden;
  }
  #selectionlist .wboxnoborder{
    padding:0;
    width: calc(100% - 0px);
    background: #fff;
    margin:0 10px;
    overflow: hidden;
  }
</style>
